package com.greenold.service.service.impl;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.greenold.common.utils.SecurityUtils;
import com.greenold.service.domain.CareLevel;
import com.greenold.service.domain.CarePlanItem;
import com.greenold.service.domain.vo.CareTaskVO;
import com.greenold.service.domain.vo.CheckInConfigVO;
import com.greenold.service.domain.vo.ElderVO;
import com.greenold.service.mapper.CareLevelMapper;
import com.greenold.service.service.ICareLevelService;
import com.greenold.service.service.ICarePlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.greenold.service.mapper.CareTaskMapper;
import com.greenold.service.domain.CareTask;
import com.greenold.service.service.ICareTaskService;

/**
 * 护理任务Service业务层处理
 *
 * @author YueYang
 * @date 2025-10-14
 */
@Service
public class CareTaskServiceImpl implements ICareTaskService {
    @Autowired
    private CareTaskMapper careTaskMapper;


    /**
     * 查询护理任务
     *
     * @param id 护理任务主键
     * @return 护理任务
     */
    @Override
    public CareTaskVO selectCareTaskById(Long id) {
        //先不查护理员姓名集合
        CareTaskVO careTaskVO = careTaskMapper.selectCareTaskById(id);
        //查询护理员姓名集合 通过床位id 有的床位没有护理员
        if (careTaskVO.getBedId() != null) {
            List<String> nurseNameList = careTaskMapper.selectNurseNameListByBedId(careTaskVO.getBedId());
            careTaskVO.setNurseNameList(nurseNameList);
        }
        return careTaskVO;
    }

    /**
     * 查询护理任务列表
     *
     * @param careTask 护理任务
     * @return 护理任务
     */
    @Override
    public List<CareTaskVO> selectCareTaskList(CareTask careTask) {
        return careTaskMapper.selectCareTaskList(careTask);
    }

    /**
     * 更新护理任务
     *
     * @param careTask 护理任务
     * @return 结果
     */
    @Override
    public int updateCareTask(CareTask careTask) {
        return careTaskMapper.updateCareTask(careTask);
    }


}
